<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>

    <button id="btn_register">用户注册</button>
    <button id="btn_selectUser">用户查询</button>
    <button id="btn_loginUser">用户登录</button>
    <button id="btn_logoutUser">用户注销</button>
    
    
    <script src="./src/node_modules/axios/dist/axios.js"></script>
    <script>
        btn_register.addEventListener('click', function () {
            axios.post("http://localhost:3005/api/lxMusic/register", {
                name: "FruitJ",
                age: 21,
                password: '123asd456',
                phone: 17803218829,
                sex: 0,
            }, {
                // headers: {
                //     'content-type': 'application/x-www-form-urlencoded',
                // },
            }).then((res) => {
                console.log(res.data);
            }).catch((err) => {
                console.log(err);
            });
        }, false);

        btn_selectUser.addEventListener('click', function () {
            axios.post("http://localhost:3005/api/lxMusic/isLxUser", {
                name: "FruitJ",
                phone: 17803218829,
            }, {
                // headers: {
                //     'content-type': 'application/x-www-form-urlencoded',
                // },
            }).then((res) => {
                console.log(res.data);
            }).catch((err) => {
                console.log(err);
            });
        }, false);
        
        btn_loginUser.addEventListener('click', function () {
            axios.post("http://localhost:3005/api/lxMusic/login", {
                phone: 17803218829,
                password: '123asd456',
            }, {
                // headers: {
                //     'content-type': 'application/x-www-form-urlencoded',
                // },
            }).then((res) => {
                console.log(res.data);
            }).catch((err) => {
                console.log(err);
            });
        }, false);
       
        btn_logoutUser.addEventListener('click', function () {
            axios.post("http://localhost:3005/api/lxMusic/logout", {
                id: 4,
            }, {
                // headers: {
                //     'content-type': 'application/x-www-form-urlencoded',
                // },
            }).then((res) => {
                console.log(res.data);
            }).catch((err) => {
                console.log(err);
            });
        }, false);
    </script>
</body>

</html>